import { $t } from '@/common/utils/i18n'
import { HOME_PAGE } from './config'

export const baseRoutes = [
  {
    // 访问根路径的路由 这里要带一个Layout，因为计算重定向的逻辑在Layout的代码中
    path: '/',
    component: 'Layout',
    redirect: HOME_PAGE,
    meta: { hideTab: true }
  },
  // 以下放置所有不需要使用Layout的路由,如单独的登录页
  {
    path: '/login',
    component: () => import('@/views/Login'),
    meta: { hideTab: true, docTitle: $t('登录') }
  }
]

export const errorRoutes = [
  {
    path: '/error',
    component: 'Layout',
    meta: { hideTab: true },
    children: [
      {
        path: '403',
        name: '403',
        component: () => import('@/views/Error'),
        meta: { docTitle: '403' },
        props: {
          title: '403',
          subTitle: $t('抱歉，您无权限访问此页面')
        }
      }
    ]
  },
  // 404路由,一定要放在最后面
  {
    path: '*',
    component: 'Layout',
    meta: { hideTab: true },
    children: [
      {
        path: '*',
        name: '404',
        component: () => import('@/views/Error'),
        meta: { docTitle: '404' },
        props: {
          title: '404',
          subTitle: $t('抱歉，您访问的页面不存在')
        }
      }
    ]
  }
]
